home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Pascal / Snippets / Fixed Point Conversions / TestFixedConversions.p < prev    next >
Encoding:
Text File  |  1995-11-14  |  628 b   |  36 lines  |  [TEXT/PJMM]

  1. (* just a silly little programme to time the Fixed-point conversions *)
  2. Program TestFixedConversions;
  3.     Uses
  4.         Events, FixedPointConversions;
  5.  
  6.     Const
  7.         kTestLoops = 10000;
  8.  
  9.     Var
  10.         FixA: Fixed;
  11.         RealA: Real;
  12.         IntA: LongInt;
  13.         StartTime, EndTime: Real;
  14.         gLoop: LongInt;
  15.  
  16. Begin
  17. {$IFC UNDEFINED THINK_Pascal}
  18. {$ELSEC}
  19. ShowText;
  20. {$ENDC}
  21.  
  22. RealA := 3;
  23. IntA := -2;
  24.  
  25. StartTime := TickCount;
  26. For gLoop := 1 To kTestLoops Do
  27.     Begin
  28.     FixA := ConvertRealToFixed(RealA);
  29.     RealA := ConvertFixedToDouble(FixA);
  30.     RealA := ConvertIntToDouble(IntA);
  31.     End;
  32.  
  33. EndTime := TickCount;
  34.  
  35. Writeln('ElapseTime :', (EndTime - StartTime) / 60 : 1 : 4);
  36. End.